﻿using SMTPAPI.InterfaceImplementation;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using SMTPAPI.Exceptions;

namespace SMTPAPIUnitTest
{
    
    
    /// <summary>
    ///This is a test class for ValidationTest and is intended
    ///to contain all ValidationTest Unit Tests
    ///</summary>
    [TestClass()]
    public class ValidationTest
    {
        /// <summary>
        ///A test for IsValidaEmail - for valid email address
        ///</summary>
        [TestMethod()]
        public void IsValidaEmailTest_ForValidEmailAddress()
        {
            Validation target = new Validation();
            string inputEmail = "erandika1986@gmail.com"; 
            bool expected = true; 
            bool actual;
            actual = target.IsValidaEmail(inputEmail);
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for IsValidaEmail - for invalid email address
        ///</summary>
        [TestMethod()]
        [ExpectedException(typeof(InvalidEmailException))]
        public void IsValidaEmailTest_ForInValidEmailAddress()
        {
            Validation target = new Validation();
            string inputEmail = ".erandika1986@gmail.comewew";
            bool actual;
            actual = target.IsValidaEmail(inputEmail);
        }

        /// <summary>
        ///A test for IsValidaEmail - for null value
        ///</summary>
        [TestMethod()]
        [ExpectedException(typeof(ArgumentNullException))]
        public void IsValidaEmailTest_ForNullValue()
        {
            Validation target = new Validation();
            string inputEmail = null;
            bool actual;
            actual = target.IsValidaEmail(inputEmail);
        }

        /// <summary>
        ///A test for IsValidaEmail - for empty string
        ///</summary>
        [TestMethod()]
        [ExpectedException(typeof(InvalidEmailException))]
        public void IsValidaEmailTest_ForEmptyString()
        {
            Validation target = new Validation();
            string inputEmail = "";
            bool actual;
            actual = target.IsValidaEmail(inputEmail);
        }
    }
}
